<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough">

    <ui:composition template="/WEB-INF/content/layout.xhtml">
        <ui:define name="title">${msg['menu.email.send']}</ui:define>
        <ui:define name="content">

<h:form id="email" prependId="false">
<table>
<tr>
    <td>
    <h:inputText id="from" value="#{sendEmail.from}" required="true">
        <f:passThroughAttribute name="data-required" value="true"/>
        <f:passThroughAttribute name="placeholder" value="${msg['email.from']}"/>
        <f:validator validatorId="EmailValidator" />
        <f:ajax render="msg"/>
    </h:inputText>
    </td>
</tr>
<tr>
    <td>
    <h:inputText id="to" value="#{sendEmail.to}" required="true">
        <f:passThroughAttribute name="data-required" value="true"/>
        <f:passThroughAttribute name="placeholder" value="${msg['email.to']}"/>
        <f:validator validatorId="EmailValidator" />
        <f:ajax render="msg"/>
    </h:inputText>
    </td>
</tr>
<tr>
    <td>
    <h:inputText id="cc" value="#{sendEmail.cc}">
        <f:passThroughAttribute name="placeholder" value="${msg['email.cc']}"/>
        <f:validator validatorId="EmailValidator" />
        <f:ajax render="msg"/>
    </h:inputText>
    </td>
</tr>
<tr>
    <td>
    <h:inputText id="bcc" value="#{sendEmail.bcc}">
        <f:passThroughAttribute name="placeholder" value="${msg['email.bcc']}"/>
        <f:validator validatorId="EmailValidator" />
        <f:ajax render="msg"/>
    </h:inputText>
    </td>
</tr>
<tr>
    <td>
    <h:inputText id="subject" value="#{sendEmail.subject}" required="true" maxlength="128" pt:placeholder="${msg['email.subject']}" pt:data-required="true">
        <f:ajax render="msg"/>
    </h:inputText>
    </td>
</tr>
<tr>
    <td>
    <h:inputTextarea id="body" value="#{sendEmail.body}" required="true" maxlength="1024" rows="5" pt:placeholder="${msg['email.body']}" pt:data-required="true">
        <f:ajax render="msg"/>
    </h:inputTextarea>
    </td>
</tr>
<tr>
    <td colspan="2">
    <h:messages id="msg" style="color:red;" />
    </td>
</tr>
<tr>
    <td colspan="2" style="text-align: right">
        <h:commandButton value="${msg['email.submit']}" action="${sendEmail.execute}">
            <f:ajax execute="from to cc bcc subject body" render="msg" onevent="handleButtonEvent" />
        </h:commandButton>
    </td>
</tr>
</table>
</h:form>

        </ui:define>
    </ui:composition>

</html>